using System.Collections;
using System.Collections.Generic;
using UnityEngine;

[System.Serializable]
public struct UpgradeAdditionRequirement {
	public WeaponTags requireTag;
	public WeaponTags excludeTag;
	public UpgradeData excludeUpgrade;

	public bool IfAddable(WeaponInstance target,UpgradeInstance toRemove) {
		if(requireTag!=WeaponTags.None&&(target.weaponData.tags&requireTag)==WeaponTags.None) return false;
		if(excludeTag!=WeaponTags.None&&(target.weaponData.tags&excludeTag)!=WeaponTags.None) return false;
		if(excludeUpgrade==null) return true;
		foreach(var i in target.upgradeInstances) {
			if(i==toRemove) continue;
			if(i.upgradeData==excludeUpgrade) return false;
		}
		return true;
	}
}
